package com.zhuhao.design_mode.behavioral_pattern.observer_pattern.java_listener;

/**
 * @Author zhuhao
 * @Date 2022/5/29 22:05
 * @desc
 */
public class Test {

    public static void main(String[] args) {
        MyEventSource myEventSource = new MyEventSource();
        //将监听事件注入到被观察者对象维护的列表中
        MyEventListenerDemo01 myEventListenerDemo01 = new MyEventListenerDemo01();
        MyEventListenerDemo02 myEventListenerDemo02 = new MyEventListenerDemo02();
        myEventSource.addListener(myEventListenerDemo01);
        myEventSource.addListener(myEventListenerDemo02);

        //传入openWindows事件，通知listener，事件监听器，对open事件感兴趣的listener将会执行
        MyEventObject openWindows = new MyEventObject("openWindows");
        myEventSource.notifyListenerEvents(openWindows);



    }
}
